home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
726-750
/
742
/
icalc
/
scripts
/
gl.ic
< prev
next >
Wrap
Text File
|
1995-03-18
|
689b
|
33 lines
# 10-pt Gauss-Legendre integration
# This is an 'open' method, i.e. it doesn't evaluate the function at
# the integration limits, so the function may be undefined there.
# However, user should consider existence of integral in such a case.
#
# nb: routines assume array base is 1
# mws, February, 1992.
array glx[5] = {
.1488743389, .4333953941, .6794095682, .8650633666, .9739065285
}
array glw[5] = {
.2955242247, .2692667193, .2190863625, .1494513491, .0666713443
}
func gl(~f,a,b) = {
local xm, xr, ss, j, dx, tmp
xm = 0.5*(b+a)
xr = 0.5*(b-a)
ss = 0
for (j = 1; j <= 5; j += 1) {
dx = xr*glx[j]
x = xm+dx
tmp = f
x = xm-dx
tmp += f
ss += glw[j]*tmp
}
xr*ss
}